<%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2020/5/18
  Time: 11:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>客户</title>
    <%@include file="/comm/head.jsp"%>
</head>
<body>
<div id="root">
    <i-table :columns="columns" :data="myData" :height="400" border stripe @on-selection-change="tableSelection=arguments[0]"><%--只要选中现发生变化时就会触发，返回值为selection，已选项--%>
        <template slot-scope="{row,index}"  slot="action">
                <i-button type="warning">修 改</i-button>
                <i-button type="error" @click="del(row,index)">删 除</i-button>
        </template>
    </i-table>
  <%--  <modal v-model="updateFlag" title="修改客户信息" @on-ok="update()">
        <i-form :label-width="80" style="padding:30px">
            <form-item label="客户名称">
                <i-input v-model="linkUser.contact" size="large"/>
            </form-item>
            <form-item label="邮政编码">
                <i-input v-model="linkUser.postCode" size="large"/>
            </form-item>
            <form-item label="手机号">
                <i-input v-model="linkUser.tel" size="large"/>
            </form-item>
            <form-item label="地址">
                <i-input v-model="linkUser.addressDesc" size="large"/>
            </form-item>
        </i-form>
    </modal>--%>

</div>
<script>
    new Vue({
        el:"#root",
        data:{
            columns:[
                // {type:"selection",width:60,align:"center"},
                {title:"客户名称",key: "contact"},
                {title:"收货地址",key: "addressDesc",width:"400px"},
                {title:"邮政编码",key: "postCode"},
                {title:"联系电话",key:"tel"},
                // {title:"修改人",key:"modifyBy"},
                // {title:"修改时间",key:"modifyDate"},
                {title:"操作",slot:"action"}

            ],
            myData:[],
           /* updateFlag:false,*/
         /*   tableSelection:[]//表格的selection表格选中的行*/
        },
        mounted(){
            this.search();
        },
        methods:{
            search(){
                axios.get(`${ctx}/sys/client/list`)
                    .then(({data})=>{
                        this.myData=data.result;

                    });
            },
/*            del(row,index){  //一般情况下查询删除用get()增加修改用post()
                let _this=this;
                let flag=iview.Modal.confirm({
                    title:"你确定要删除吗？",
                    content:"该操作不可逆，请谨慎操作。",
                    onOk(){
                        axios.get(`${ctx}/sys/client/del?id=${row.id}`)
                            .then(({data})=>{
                                iview.Message.success({content:data.msg});
                                _this.data.splice(index,1);

                            })
                    },
                });

            },*/
        }
        })
</script>
</body>
</html>
